package com.chanyachting.emall.action.recruitmentinformation;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.chanyachting.emall.domain.Recruitmentinformation;
import com.chanyachting.emall.form.RecruitmentinformationForm;
import com.chanyachting.emall.service.RecruitmentinformationService;
import com.chanyachting.emall.serviceImpl.RecruitmentinformationServiceImpl;
import com.chanyachting.emall.util.DateUtil;
import com.chanyachting.emall.util.RequestUtil;

public class UpdateAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		RequestUtil ru=new RequestUtil(request);
		
		RecruitmentinformationForm riform=(RecruitmentinformationForm)form;
		
		Recruitmentinformation ri=new Recruitmentinformation();
		
		BeanUtils.copyProperties(ri, riform);
		
		ri.setUpdateDate(DateUtil.getDate());
		
		RecruitmentinformationService ris=new RecruitmentinformationServiceImpl();
		
		try {
			
			if(ris.updateRecruitmentinformation(ri)){
				
				ru.setSuccessMsg();
				
			}else{
				
				ru.setFailMsg();
			}
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}
		
		
		
		return mapping.findForward("");
	}
	
	

}
